import db from "../utils/db"

export function getAllLab() {
  return db.labProcess.toArray();
}

export function addOrUpdateLab(item) {
  if (item.id === undefined || item.id === "" || item.id === null) {
    delete item["id"]
    db.labProcess.add(item);
  } else {
    db.labProcess.put(item);
  }
}

export function deleteLabById(id) {
   db.labProcess.delete(id);
}

export function deleteLabByConditionEqual(condition, value) {
  return db.labProcess.where(condition).equals(value).delete();
}
